import axios from "../src/utils/http"
//获取手机验证码
export function getCodes(name,phoneNum){
    let obj = new URLSearchParams();
    obj.append('loginName',name);
    obj.append('mobile',phoneNum);
    return axios.post('/api/pcUser/forgetpassword/send/code',obj);
}
//修改密码
export function toChange(loginName,pwd,mobile,code){
    let obj = {
        "loginName":loginName,
        "password":pwd,
        "mobile":mobile,
        "code":code
    }
    return axios.post("/api/pcUser/password/forget",obj)
}
//普通登录
export function commonLogin(user,pwd){
    let obj = new URLSearchParams();
    obj.append('username',user);
    obj.append("password",pwd);
    obj.append("rememberMe","true")
    return axios.post("/api/pcUser/login",obj)
}
//手机号登录获取验证码
export function phoneGetCode(phone){
    return axios.get(`/api/pcUser/login/send/code/${phone}`)
}
//获取验证码后登录
export function phoneToLogin(mobile,code){
    let obj = new URLSearchParams();
    obj.append("mobile",mobile);
    obj.append("code",code);
    obj.append("rememberMe",true)
    return axios.post("/api/pcUser/login/mobile",obj)
}
//退出登录
export function exitLogin(){
    return axios.get("/api/pcUser/logout");
}